#include "system.h"

void system_init(void)
{
    GPIOC->ODR |= 0x00ff;
    GPIOC->ODR &= 0xffff;

    GPIOD->BSRR |= 0x01 << 2;
    GPIOD->BRR |= 0x01 << 2;
}

char old_out_mode = 'L';
void count_proc(void)
{
    if(out_lock)
    {
        uint32_t out_now_tim = HAL_GetTick();
        if(out_now_tim >= out_lock_time + 5000)
        {
            out_lock = 0;
            if(out_mode == 'L')
            {
                out_mode = 'H';
            }
            else if (out_mode == 'H')
            {
                out_mode = 'L';
            }
        }
    }

    if (old_out_mode != out_mode)
    {
        putout_count++;
        old_out_mode = out_mode;
    }
}